package com.xjl.sort;

/**
 * @描述: 递归算法
 *
 * @作者: XUJIANLIN
 */
public class Recursive {


    public static int getMax(int[] arr, int Left, int Right) {

        if (Left == Right){
            return arr[Left];
        }

        int mid = (Left + Right)/2;

        int LeftMax = getMax(arr, Left, mid);
        int RightMax = getMax(arr, mid+1, Right);

        return Math.max(LeftMax, RightMax);

    }



    public static void main(String[] args) {
        int[] arr = {4,6,1,7,8,9,0};
        System.out.println(getMax(arr,0,arr.length-1));
    }

}
